/** @file               sw_dir.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_DIR_H__
#define __SW_DIR_H__

#ifdef __cplusplus
extern "C" {
#endif

#ifdef WIN32
typedef SW_VOID             *SW_DIR;
#define SW_INVALID_DIR      NULL
#else
typedef SW_VOID             *SW_DIR;
#define SW_INVALID_DIR      NULL
#endif

typedef SW_RET (*SW_FILE_FOUND_PROC)(const SW_CHAR *pDirName, const SW_CHAR *pBaseName, SW_BOOL isDir, SW_BOOL *pFinished, SW_VOID *pArg);

SW_API SW_RET SW_InitDirAPI(SW_VOID);
SW_API SW_RET SW_RunDirAPI(SW_VOID);
SW_API SW_RET SW_StopDirAPI(SW_VOID);
SW_API SW_RET SW_ExitDirAPI(SW_VOID);
SW_API SW_DIR SW_OpenDir(const SW_CHAR *pDirName);
SW_API SW_RET SW_ReadDir(SW_DIR dir, SW_CHAR *pFileName, SW_UINT32 fileNameLen);
SW_API SW_RET SW_CloseDir(SW_DIR dir);
SW_API SW_RET SW_RewindDir(SW_DIR dir);
SW_API SW_RET SW_CreateDir(const SW_CHAR *pDirName);
SW_API SW_RET SW_DeleteDir(const SW_CHAR *pDirName);
SW_API SW_BOOL SW_IsDir(const SW_CHAR *pFileName);
SW_API SW_RET SW_GetCurDir(SW_CHAR *pDirName, SW_UINT32 dirNameLen);
SW_API SW_RET SW_SetCurDir(const SW_CHAR *pDirName);
SW_API SW_RET SW_IterateDir(const SW_CHAR *pDirName, SW_BOOL recurse, SW_FILE_FOUND_PROC foundProc, SW_VOID *pArg);

#ifdef __cplusplus
}
#endif

#endif

